﻿using Microsoft.Xna.Framework.Media;

namespace Serialization.Script
{
    /// <summary>
    /// An event that is called when a background music is getting set.
    /// </summary>
    public class Event_SetMusic : ScriptedEvent
    {
        private Song music
        {
            get;
            set;
        }

        /// <summary>
        /// Plays and loops the background music at the set volume.
        /// </summary>
        public virtual void execute()
        {
            MediaPlayer.Play(music);
            MediaPlayer.Volume = GlobalGameClasses.GlobalGameValues.Values.volume_Music / 100f;
            MediaPlayer.IsRepeating = true;
        }

        public Event_SetMusic(string music, int eventTime)
        {
            this.music = GlobalGameClasses.GlobalGameValues.Values.content.Songs[music];
            this.eventTime = eventTime;
        }

        public override int getNumberOfEnemies()
        {
            return 0;
        }
    }

    
}

